package testMaker;

import java.io.File;
import java.io.IOException;

public class TestMaker {

	public static void main(String[] args) throws IOException {
		
		String[] instancefiles = {"instances/dim10", "instances/dim11", "instances/dim12", "instances/dim13", "instances/dim14", "instances/dim15"};
		
		String[] uncertsetfiles = {"set/dim10", "set/dim11", "set/dim12", "set/dim13", "set/dim14", "set/dim15"};
		
		String[][] outfiles = new String[100][4];
		File[] intances;
		File[] us;
		File usi;
		Process process;
		double[] gam = {0.25, 0.5, 0.75};
		int[] vk = new int[4];
		int[] gamma = {5,5,6,6,7,7,8,8};
		
		for(int dim = 0; dim < 3; dim++){
			intances = new File(instancefiles[dim]).listFiles();
			us = new File(uncertsetfiles[dim]).listFiles();
			vk[0] = -dim - 10;
			vk[1] = 1;
			vk[2] = 0;
			vk[3] = dim + 10;
			
			for(int algo = 0; algo < 4; algo++){
				outfiles[dim][algo] = "ResultsDIM="+Integer.toString(dim) +"ALGO="+Integer.toString(algo) +".txt";
				
				for(int k = 0; k < 4; k++){
					for(File di : intances){
						for(int j = 0; j < 6; j++){
							usi = us[j];
							String exp = "java -jar WAREHOUSE.jar "+
									Integer.toString(vk[k])+ " "+
									Integer.toString(algo)+ " "+
									Integer.toString(dim + 10) + " "+
									Integer.toString(gamma[dim]) + " "+
									di.toString() + " " +
									usi.toString() + " " +
									outfiles[dim][algo].toString()+ " " +
									Integer.toString(0);
								
								
							
							process = Runtime.getRuntime().exec(exp);
							System.out.println(exp);
							try {
								process.waitFor();
							} catch (InterruptedException e) {
								System.out.println("*****Problems with the Waiting*****");
							System.out.println("*****End of the solution!*****");
						}
					}
				}
			}
		}
			
		}

	}

}
